import request from '@/utils/request'

export function getList(params) {
  return request({
    url: '/manager/users',
    method: 'post',
    data: params
  })
}

export function getUserType() {
  return request({
    url: '/manager/users/mgrUserTypes',
    method: 'post'
  })
}

export function getAreaList() {
  return request({
    url: '/manager/area/areaCascadeSupply',
    method: 'post'
  })
}

export function getSchoolsById(id) {
  return request({
    url: `/manager/school/schoolsByAreaId/${id}`,
    method: 'get'
  })
}

export function getId(id) {
  return request({
    url: `/manager/users/mgrUserInfo/${id}`,
    method: 'post',
    data: id
  })
}

export function update(params) {
  return request({
    url: '/manager/users/editUser',
    method: 'post',
    data: params
  })
}

// POST / users/userForbidden
// 用户禁言
export function userForbidden(params) {
  return request({
    url: '/manager/users/userForbidden',
    method: 'post',
    data: params
  })
}

// /exportExcel/exportUserInfoExcel
// exportUserInfoExcel
export function exportUserInfoExcel(params) {
  return request({
    url: '/tools/exportExcel/exportUserInfoExcel',
    method: 'post',
    data: params
  })
}

// /school/schoolsByTitle/{title}
// 根据学校名称模糊查询学校
export function getSchoolsByTitle(params) {
  return request({
    url: `/manager/school/schoolsByTitle`,
    method: 'post',
    data: params
  })
}

// 创建新用户
export function addNewUser(params) {
  return request({
    url: '/mgrService/mgrUser/createNewUser',
    method: 'post',
    data: params
  })
}

// 筛选某地区下学校
export function getHighSchool(params) {
  return request({
    url: '/mgrService/mgrUser/queryHighSchoolByFilter',
    method: 'post',
    data: params
  })
}

// 批量导入Excel用户
export function upload(params) {
  return request({
    url: '/mgrService/mgrUser/batchImportUserExcel',
    method: 'post',
    data: params
  })
}

// 通过用户id查询用户详情
export function showUserInfo(id) {
  return request({
    url: `/mgrService/mgrUser/queryUserInfoByUserId/${id}`,
    method: 'get',
    data: [id]
  })
}

// 编辑用户信息
export function updateUser(params) {
  return request({
    url: '/mgrService/mgrUser/updateUserInfoById',
    method: 'post',
    data: params
  })
}
